﻿using System;
using System.Collections.Generic;
using Eamon.MeituanDotnetSDK.api.common.request;
using Eamon.MeituanDotnetSDK.api.oauth.@enum;
using Eamon.MeituanDotnetSDK.utils;

namespace Eamon.MeituanDotnetSDK.api.oauth.entity
{
    public class RefreshTokenRequest : BaseOAuthRequest
    {
        /// <summary>
        /// refreshToken
        /// </summary>
        private string refreshToken;

        private string grantType;

        private string scope;

        public RefreshTokenRequest(int businessId, string refreshToken) :base(businessId)
        {
            this.refreshToken = refreshToken;
            this.grantType = "refresh_token";
            this.scope = "all";
        }

        public override Dictionary<string, object> toParams()
        {
            Dictionary < string, object > pairs = new Dictionary<string, object>();
            pairs.Add(CommonConstants.BUSINESS_ID, BusinessId);

            if (grantType != null)
            {
                pairs.Add("grantType", grantType);
            }
            if (refreshToken != null)
            {
                pairs.Add("refreshToken", refreshToken);
            }
            if (scope != null)
            {
                pairs.Add("scope", scope);
            }
            return pairs;
        }
    }
}
